
#ifndef BLOCK_H
#define	BLOCK_H

#include "Disk.h"

class Block {

    public:
            Block(int blockNumber, int length);
            ~Block();
            Block (int length);
            void ClearBuffer();
            int GetBlockNumber();
            void SetBlockNumber (int number);
            Block (int blockNumber, Disk *disk);
            bool Write (Disk *disk);
            unsigned char *GetBuffer();
            void SetBuffer(unsigned char *buffer);
            void SetPointer(int pointer, int location);
            int GetPointer(int location);
            void Print();
            static void Test();

            /**
             * Location of pointer to start block number of freelist
             */
            static const int FREELIST_START_BLOCK_NUMBER = 0;
            /**
             * Location of pointer to end block number of freelist
             */
            static const int FREELIST_END_BLOCK_NUMBER = 1;
            /**
             * Location of pointer to number of  blocks in freelist
             */
            static const int FREELIST_NUMBER_OF_BLOCKS = 2;
            /**
             * Location of pointer to start block number of directory
             */
            static const int DIRECTORY_START_BLOCK_NUMBER = 3;
            /**
             * Location of pointer to end block number of directory
             */
            static const int DIRECTORY_END_BLOCK_NUMBER = 4;
            /**
             * Location of pointer to number of  blocks in directory
             */
            static const int DIRECTORY_NUMBER_OF_BLOCKS = 5;
            /**
             * Location of pointer to number of  directory entries in directory
             */
            static const int NUMBER_OF_DIRECTORY_ENTRIES = 6;


    private:
            /**
             * Stores the char representation of the Block
             */
             unsigned char* m_buffer;
             /**
              * the location of this block on disk
              */
             int m_blockNumber;

};

#endif	